Hello,
I've put up the source code to a project I made to handle logging and
plotting of kflop data over extended periods. So more than the 3.5
seconds that can be gathered using the step/response screen in kmotion.
I'm using this to tune my really slow/low precision axis. However I
tried to make it generic enough that you can use it to log and plot just
about anything from the kflop. Limitations include that the x axis is
assumed to be time (or any other incrementing value) that you wish to
plot the other variables against. It can do simple transforms on the
data (add/sub/mul/div), this could be extended to use more complex
formulas... but for now good enough to do error plots for command
position...
plots appear as the data is generated on the kflop
You can view plots side by side, sync their axis etc..
You can save and load the data into a blank plot.
Export to image file (png)
plot configuration can be saved and reused.
A session can be saved (what C files you have open for editing, and
current plots open), note however that currently the data is NOT coupled
to the saved session. You have to save the data generated for plot
separately, and load it manually after opening a previous session.
You might find it useful to track down problems in your system by
setting up a thread to trigger logging when some problem sequence run...
I'm still learning how the kflop API works so this may not play well
with other apps. One thing I have noticed is that the console handler
is a "last to register wins". So if you have two kflop apps running
(KmotionCNC and this logging app) the last one to start gets the
console. And this app requires the console to run. This may limit
the utility.
A small demo:
https://youtu.be/BisZrkeGMLM (sorry a bit of hum in a few places).
The source can be found here:
https://gitlab.com/Greg9504/ExtendedLoggingKflop
There is a readme.md with instructions on how it works and how to
download and install. Pre compiled binaries are for 4.34a. Use at your
own risk. Source is .net c#, the application is WPF, project is VS 2015.
For Tom
Some timing information for various log formats:
Control run, no printf just doing calculations in loop of 10000 - time
7.2 seconds
printf using %g (or %f) time - 10.8 seconds, max data rate 32 kB/sec,
printf("@0,%g,%g,%g,%g\n", tcurr.dValue, y1.dValue, y2.dValue, y3.dValue)
printf using hex dump, time - 14.4 seconds, max data rate 57 kB/sec ,
printf("@0,%08X%08X,%08X%08X,%08X%08X,%08X%08X\n", tcurr.iValue.iValue2,
tcurr.iValue.iValue1,
y1.iValue.iValue2, y1.iValue.iValue1,
y2.iValue.iValue2, y2.iValue.iValue1,
y3.iValue.iValue2, y3.iValue.iValue1);
sprintf using hex dump (data not transmitted), time - 14.4 seconds
To transmit as hex I define this struct:
typedef union _DoubleAsUInt_ {
double dValue;
struct iValue {
unsigned int iValue1;
unsigned int iValue2;
}iValue;
} DoubleAsUInt;
Then set the value using: DoubleAsUInt tcurr; tcurr.dValue = Time_sec()
- T0;
The printf using this shouldn't have any floating point math... but it
takes much longer to generate the buffer (sprintf takes just as long as
printf which has to send the data).
For now I've compiled the app to assume the data is in string format
(not hex). If you wish to test yourself set FromHex to true in the
PlotViewModel.cs constructor (~ line 95).